iPhoneJS.extend({
	translate : function (elem , args, callback){
		var x = args.x ? parseInt(args.x) : undefined,
			y = args.y ? parseInt(args.y) : undefined,
			z = args.z ? parseInt(args.z) : undefined,
			duration = args.duration || "0.5s";
		
		pos = []; if (x) pos.push(x); if (y) pos.push(y); if (z) pos.push(z);
		
		$(elem).transition({property:"-webkit-transform",duration:duration});
		
		elem.style.setProperty("-webkit-transform","translate("+(pos.join('px,'))+"px)", "");
		
		elem.addEventListener('webkitTransitionEnd', function(e){
				//remove event listener
				elem.removeEventListener("webkitTransitionEnd",arguments.callee ,false);
				//exec callback
				callback.apply(elem, [args])
			} , false);
	},
	
	transition : function(elem, args, callback){
		args = (args)?args:{};
		var property = args.property 	|| "all",
			timing = args.timing 		|| "ease-in-out"
			duration = args.duration 	|| "0.5s";
		
		/*
		elem.style.webkitTransitionProperty = property;
		elem.style.webkitTransitionDuration = duration;
		elem.style.webkitTransitionTimingFunction = timing;
		*/
		
		elem.style.webkitTransition = [property, duration, timing].join(" ");
		
		if(callback)
			elem.addEventListener('webkitTransitionEnd', function(e){
					//remove event listener
					elem.removeEventListener("webkitTransitionEnd",arguments.callee ,false);
					//exec callback
					callback.apply(elem, [args])
				} , false);
	}
});

iPhoneJS.fn.extend({
	translate : function(args, callback){
		iPhoneJS.translate (this[0],args, callback);
 	},
 	
	transition : function(args, callback){
		iPhoneJS.transition (this[0], args, callback);
 	}
});